package com.ewhome.apartment.mvp.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.alibaba.android.vlayout.DelegateAdapter;
import com.alibaba.android.vlayout.LayoutHelper;
import com.chad.library.adapter.base.BaseViewHolder;
import com.ewhome.apartment.R;
import com.ewhome.apartment.mvp.model.entity.SectionData;
import com.jess.arms.utils.ArmsUtils;

/**
 * author:zhangjing
 * 作用:
 * return:
 */

public class SectionAdapter extends DelegateAdapter.Adapter<BaseViewHolder>{

    private Context mContext;

    private LayoutHelper mLayoutHelper;

    private SectionData sectionData;
    public SectionAdapter(Context mContext, LayoutHelper mLayoutHelper,SectionData sectionData) {
        this.mContext = mContext;
        this.mLayoutHelper = mLayoutHelper;
        this.sectionData=sectionData;
    }

    @Override
    public LayoutHelper onCreateLayoutHelper() {
        return mLayoutHelper;
    }

    @Override
    public BaseViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View view= LayoutInflater.from(mContext).inflate(R.layout.section_title,parent,false);
        return new BaseViewHolder(view);
    }

    @Override
    public void onBindViewHolder(BaseViewHolder holder, int position) {
        holder.<TextView>getView(R.id.section_title).setText(sectionData.getSection());
        holder.<TextView>getView(R.id.section_label).setText(sectionData.getLabel());
    }

    @Override
    public int getItemCount() {
        return 1;
    }
}
